package com.hdax.dm.rabbitMQ;

import com.hdax.dm.feign.order.OrderFeign;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@RabbitListener(queues = {"dm_order_rollback"})
public class OrderRollBack {

    @Autowired
    private OrderFeign orderFeign;

    /**
     * 回滚订单
     * @param orderNo
     */
    @RabbitHandler
    public void orderRollBack(String orderNo){
        orderFeign.deleteOrderByNo(orderNo);
        System.out.println("订单被回滚了-------------");
    }

}
